export function filterField(
  obj: Record<string, unknown>
): Record<string, unknown> {
  const result: Record<string, unknown> = {};

  Object.entries(obj).forEach(([key, value]) => {
    if (value === undefined || value === null || value === "") {
      return; // 跳过这些无效值
    }

    if (typeof value === "object" && !Array.isArray(value)) {
      const nested = filterField(value as Record<string, unknown>);
      if (Object.keys(nested).length > 0) {
        result[key] = nested;
      }
    } else {
      result[key] = value;
    }
  });

  return result;
}
